package com.proxy.autoclick.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {
	
	public static boolean checkStringIfFollowPattern(String candidate,String [] regexString)
	{
		candidate = candidate
				.replaceAll("\r", "")
				.replaceAll("\n", "")
				.replaceAll("\r\n", "");
		String regex = "";
		for (int i = 0; i < regexString.length; i++)
		{
			regex += ".*" + regexString[i] +".*" ;
			if(i != regexString.length -1)
			{
				regex += "|";
			}
		}
		Pattern pattern = Pattern.compile(regex);  
	    Matcher matcher = pattern.matcher(candidate);
		return matcher.matches();
	}

}
